package com.ruoyi.product.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.product.domain.dto.WoSubFaultDto;
import com.ruoyi.product.service.WoSubFaultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/woRawSubRelFault")
public class WoSubFaultController {
    @Autowired
    WoSubFaultService woSubFaultService;

    @PostMapping("/getWoRawSubRelFaultByPage")
    public R export(@RequestBody WoSubFaultDto materialDto)
    {
        return R.ok(woSubFaultService.getWoRawSubRelFaultByPage(materialDto));
    }

    @PostMapping("/addWoRawSubRelFault")
    public R addTest(@RequestBody WoSubFaultDto materialDto){
        woSubFaultService.addWoRawSubRelFault(materialDto);
        return R.ok("添加成功");
    }


    @PostMapping("/addWoRawSubRelFaultByScada")
    public R addWoRawSubRelFaultByScada(@RequestBody WoSubFaultDto materialDto){
        woSubFaultService.addWoRawSubRelFaultByScada(materialDto);
        return R.ok("添加成功");
    }

    @PostMapping("/delWoRawSubRelFault")
    public R delTest(@RequestBody WoSubFaultDto materialDto){
        woSubFaultService.delWoRawSubRelFault(materialDto);
        return R.ok("删除成功");
    }

    @PostMapping("/updateWoRawSubRelFault")
    public R updateTest(@RequestBody WoSubFaultDto materialDto){
        woSubFaultService.updateWoRawSubRelFault(materialDto);
        return R.ok("锁定成功");
    }
}
